package com.android.myj.view;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;

import com.android.myj.R;

public class Main extends TabActivity {
	private TabHost tabHost;
	private static final String HOME = "主页";
	private static final String REFER = "提及";
	private static final String SECRET = "私信";
	private static final String SEARCH = "搜索";
	private static final String ATTENTIION = "关注";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tabhost);
		tabHost = this.getTabHost();

		// 主页
		View view1 = View.inflate(Main.this, R.layout.tab, null);
		((ImageView) view1.findViewById(R.id.tab_imageview_icon))
				.setImageResource(R.drawable.tab_timeline_selector);
		((TextView) view1.findViewById(R.id.tab_textview_title)).setText(HOME);

		TabHost.TabSpec spec1 = tabHost.newTabSpec(HOME);
		Intent homeIntent = new Intent(this, HomeTimeLine.class);
		spec1.setIndicator(view1);
		spec1.setContent(homeIntent);
		tabHost.addTab(spec1);

		// 提及
		View view2 = View.inflate(Main.this, R.layout.tab, null);
		((ImageView) view2.findViewById(R.id.tab_imageview_icon))
				.setImageResource(R.drawable.tab_atme_selector);
		((TextView) view2.findViewById(R.id.tab_textview_title)).setText(REFER);

		TabHost.TabSpec spec2 = tabHost.newTabSpec(REFER).setIndicator(view2)
				.setContent(new Intent(Main.this, Refer.class));
		tabHost.addTab(spec2);

		// 私信
		View view3 = View.inflate(Main.this, R.layout.tab, null);
		((ImageView) view3.findViewById(R.id.tab_imageview_icon))
				.setImageResource(R.drawable.tab_message_selector);
		((TextView) view3.findViewById(R.id.tab_textview_title))
				.setText(SECRET);
		TabHost.TabSpec spec3 = tabHost.newTabSpec(SECRET).setIndicator(view3)
				.setContent(new Intent(this, Messages.class));
		tabHost.addTab(spec3);

		// 搜索
		View view4 = View.inflate(Main.this, R.layout.tab, null);
		((ImageView) view4.findViewById(R.id.tab_imageview_icon))
				.setImageResource(R.drawable.tab_explore_selector);
		((TextView) view4.findViewById(R.id.tab_textview_title))
				.setText(SEARCH);

		TabHost.TabSpec spec4 = tabHost.newTabSpec(SEARCH).setIndicator(view4)
				.setContent(new Intent(this, Search.class));
		tabHost.addTab(spec4);

		// 关注
		View view5 = View.inflate(Main.this, R.layout.tab, null);
		((ImageView) view5.findViewById(R.id.tab_imageview_icon))
				.setImageResource(R.drawable.tab_focus_selector);
		((TextView) view5.findViewById(R.id.tab_textview_title))
				.setText(ATTENTIION);

		TabHost.TabSpec spec5 = tabHost.newTabSpec(ATTENTIION).setIndicator(
				view5).setContent(new Intent(this, Attention.class));
		tabHost.addTab(spec5);
	}
}
